package com.ytf.test.third;

/**
 * @author: YTF
 * @date: 2024/9/13 16:41
 * @version: 1.0
 * @description:
 */
public class CastingNumbers {
    public static void main(String[] args) {
        double above = 0.7, below = 0.4;
        float fAbove = 0.7f, fBelow = 0.4f;
        System.out.println("above:"+above+" (int)above:"+(int)above);
        System.out.println("below:"+below+" (int)below:"+(int)below);
        System.out.println("fAbove:"+fAbove+" (int)fAbove:"+(int)fAbove);
        System.out.println("fBelow:"+fBelow+" (int)fBelow:"+(int)fBelow);
        /**
         * Output:
         * above:0.7 (int)above:0
         * below:0.4 (int)below:0
         * fAbove:0.7 (int)fAbove:0
         * fBelow:0.4 (int)fBelow:0
         * 总结：
         *  强转是直接结尾不会四舍五入
         */
    }
}
